<?php
/**
 * Created by PhpStorm.
 * User: kun
 * Date: 23/6/19
 * Time: 20:37
 */

namespace app\common\model;


class Version extends Base
{
    public function profile()
    {
        return $this->hasOne('Versioncate', 'id', 'app_type');
    }


    /**
     * 通过apptype获取最后一条版本内容
     * @param string $appType
     * @return mixed
     */
    public function getLastNormalVersionByAppType($appType = '')
    {
        $data = [
            'status' => 1,
            'app_type' => $appType
        ];
        $order = [
            'id' => 'desc',
        ];

        return $this->where($data)
            ->order($order)
            ->limit(1)
            ->find();

    }

}